/**
 * Project: topdt-jbpm
 * Copyright 2013  Top Digital Technology  Co. Ltd.
 * All right reserved.
 */
package com.topdt.jbpm.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.thx.common.orm.HibernateBaseDao;
import com.topdt.jbpm.model.FormInstance;

/**
 * 建立日期 : 2013-4-25 上午11:22:43<br>
 * 作者 : balance<br>
 * 模块 : <br>
 * 描述 : <br>
 * 修改历史: 序号 日期 修改人 修改原因 <br>
 * 1 <br>
 * 2 <br>
 */
@Repository
public class FormInstanceDao extends HibernateBaseDao<FormInstance> {

	@SuppressWarnings("unchecked")
	public FormInstance getById(String workId) {
		String hql = "from FormInstance where workId =?";
		List list = createQuery(hql, new Object[] { workId }).list();
		if (list.size() > 0)
			return (FormInstance) list.get(0);

		return null;
	}

	public int deleteById(String workId){
		String hql="delete from FormInstance where workId=?";
		return createQuery(hql,workId).executeUpdate();
	}


}
